package sit.engreal.leetcode.problems100;

/**
 * <a href="https://leetcode.cn/problems/container-with-most-water/">11. 盛最多水的容器</a>
 */
public class LeetCode100 {
    public int maxArea(int[] height) {
        int area = 0;
        for (int i = 0, j = height.length - 1; i < j; ) {
            if (height[i] < height[j]) {
                area = Math.max(area, (j - i) * height[i]);
                i++;
            } else {
                area = Math.max(area, (j - i) * height[j]);
                j--;
            }
        }
        return area;
    }
}
